<h1>Agregar nueva Salida de Material</h1>
<% form_for :salida_material, @salida_material, :url => {:action => 'create'} do |s| %>
  <%= error_messages_for :salida_material %>
<p><label>Centro de Consumo</label>&nbsp;<%= s.collection_select(:centro_id, @centros, :id, :nombre_comercial, {:include_blank => true}) %></p>
  <p><label>Num. de Req. de Compra</label>&nbsp;<%= s.text_field(:folio) %></p>
  <p><label>Observaciones</label>&nbsp;<%= s.text_area(:observaciones, :rows => 4, :cols => 40) %></p>
  <h2>Materiales</h2>
  <table>
    <thead>
      <th>Clave</th>
      <th>Descripci&oacute;n</th>
      <th>Cantidad</th>
      <th>Precio</th>
    </thead>
    <tbody id="detalles">
      <%= render :partial => "detalle", :collection => @salida_material.salida_material_detalles %>
    </tbody>
  </table>
  <p><%= link_to_function 'Agregar Material' do |page| 
      page.insert_html :bottom, :detalles, :partial => 'detalle', :object => SalidaMaterialDetalle.new 
  end %></p>
  <p><%= submit_tag "Guardar" %></p>
<% end %>
<p><%= link_to "Regresar", :action => "index" %></p>